﻿using System.Collections.Generic;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MyCompany.WebCrawler.Domain;

namespace MyCompany.WebCrawler.Test.Domain.DownloaderTests.Given_Page
{
    [TestClass]
    public class When_ExtractLinks : Context
    {
        private List<string> links;
        private const string link = "http://google.com";

        public override void Act()
        {
            var downloader = new Downloader
                {
                    Page = "<a href=\"" + link + "\">Link</a>"
                };

            links = downloader.ExtractLinks();
        }

        [TestMethod]
        public void Then_1LinkWasFound()
        {
            links.Count.Should().Be(1);
        }

        [TestMethod]
        public void Then_LinkContainGoogleUrl()
        {
            links[0].Should().Be(link);
        }
    }
}